package com.exchange.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 绑定我们实现心跳机制的rabbitmq
 * @Author : RulerWood
 * @Data : 2024/5/9 - 9:54
 */
@Configuration
public class BeatExchangeConfig {

    @Bean(name = "queue-beat")
    public Queue queue1() {
        return QueueBuilder.durable("queue-beat").build();
    }

    @Bean(name = "exchange-beat")
    public Exchange exchange1() {
        return ExchangeBuilder.directExchange("exchange-beat").build();
    }

    @Bean(name = "binding-beat")
    public Binding binding1() {
        return BindingBuilder.bind(queue1()).to(exchange1()).with("routing-key-beat").noargs();
    }


}
